import pymysql

conn = pymysql.connect(host='localhost',user='root',passwd='123456',db='test01',charset='utf8')

cursor = conn.cursor()

cursor.execute("select version()")

result = cursor.fetchone()

print("result=",result)

cursor.close()

conn.close()